package com.mdz.nc.Service.Impl;

import cn.hutool.crypto.SecureUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.mdz.nc.Entity.SysUser;
import com.mdz.nc.Mapper.SysUserMapper;
import com.mdz.nc.Service.SysUserService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 用户信息表 服务实现类
 * </p>
 *
 * @author 孟德志
 * @since 2020-03-28
 */
@Service
public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> implements SysUserService {

    @Autowired
    private SysUserMapper sysUserMapper;

    @Override
    public boolean login(SysUser user) {
        String loginName=user.getLoginName();
        String loginPassword= SecureUtil.md5(user.getLoginPassword());
        Integer i= sysUserMapper.selectCount(new QueryWrapper<SysUser>().eq("login_name",loginName).eq("login_password",loginPassword));
        if(i!=0){
            return true;
        }
        return false;
    }

    @Override
    public List<SysUser> getList() {
        return null;
    }
}
